#define _CRT_SECURE_NO_WARNINGS 1


#include <stdio.h>

int im_atoi(const char* str)
{
	int sign = 1;
	while (*str < 48 || *str>57)
	{
		if (*str == 45)
		{
			sign = -1;
		}
		++str;
	}
	long long ret = 0;
	while (*str >= 48 && *str <= 57)
	{
		ret = 10 * ret + sign * (*str - '0');
		++str;
		if (ret > 2147483647 || ret < -2147483647 - 1)
		{
			return 0;
		}
	}
	return (int)ret;
}



int main()
{
	int ret = im_atoi("    ab-1132");
	printf("%d", ret);
	return 0;
}